small refactor

no need to pass race as an argument, as it may get changed and re-cast after
entering the function.
cancel abortion between stages

wait... what?
walk sound fix
math fix
pathing fix
fix portability issue