Start to experiment with query_scope and create_scope
refactor query controller