Made some changes and clean up the code some