Some optimizations

I've added some speed optimizations to the code, and reformatted Utils.java (which was full of different identations, with some tabs here, and spaces there)