slight code refactor