Added SQL and changed the repository to match
Made code look more butiful