Add some more helper methods and start implementing the sql