Attempting to clean up code