:telescope: Refactored some of the work sql into scopes