added sonar tracking, cleaned up code, implemented a logger