clean up code an refactor