small refactor of code