Moved queries to Repository classes.
Fixed broken schema