nup code rewritten to comply with the new startframe/endframe interface