trying to clean up code