formatted code and seemingly improved runtime some more