cleanup: remove stale code and make sure stuff is called only once.