Added some ORM functions, lot more cleaning up needed