avoid array exansion and reversal

push() changes the length of the array which has a small cost. also this
way avoids the need for a final reversal which is both slow and ugly