moved data query to factory