code cleanup

fix indention
remove trailing spaces (lowers risk of merge conflicts)
move some stuff to constants
remove unused vars
turn var = something; if var into if var = something
remove "returns"