unnecessary pushes/pops
misc cleanups
debug logging support
refactoring for clarity and adding cycle timing