refactor SELECT for readability