cleanup: various code cleanup