Cleaned up some code(removed functions, moved functions)