small code refactor