small refactor to make code cleaner