First attempt at making buffers work

Added a Buffer type to the AppState, with a current buffer and list of available
buffers in the state. Everything now operates on buffers instead of the appstate
itself. Also switched everything to using IO instead of having multiple
functions for pure/IO. This made it easier to remake all of the mappings, to
make way for buffers.