SOme minor cleanup of functions to make them look a bit cleaner and more obvious