Cleaned up query, added comments