cleaned up whitespaces, some code things, and speed calculation