Over all code cleanup. Small bit of refactorying also.