refactor making GET query method