fix: last moment fixes, and code cleanup
