code cleanup
turned reading into an asm.js routine