fixup! fixup! fixup! Refactor and improvements