Removed some unnecessary functions and some other cleanup