slight cleanup
cleaned up, added intermediate variables, more readable