Changed function naming convention and other minor fixes