tidy up based on sonar