refactored get_data to use an in clause for proper ordering of results.