use scope to move query details into model