clean upped some code