Switched utility functions to use var for variable declaration