refactoring
unboxed versions, with various attempts
benchmarks and tests with the unsafe version- mega slow