Added in most of the basic functionality, still needs work.