cleanup: remove unused code, fix warnings