basic o/r mapping implementation, lots of optimizations to do