Few end of function warnings taken care of