refactor: minor general refactor and improvements