fixed a bug with the loop and turned new bit into a function

tested and this provides a HUGE performance boost on data loads