Added documentation, and fleshed out architecture.