add "const" where needed and some styling
biggest bug fix commit evar