refactor: less code complexity