added sonar integration and fixed associated bugs