refactor: various improvements