Added a bunch of garbage collections and used float32s wherever possible to save on memory