Cleaning up code complexity