all: cleanups and refactoring