Basic architectural changes

Fixed up some basic architecture. Added buffering support (I don't know
why I did this first, but it's there so...)
Merge pull request #1 from keechwa/master

Basic architectural changes