change to float, improve vectorization + cleanup