cleaned code and commits for readability