Minor code refactor