Fixing stuff

fixed a whole bunch of stuff. Changed so that there is a main message
loop for input (sometime soon) and a function to handle a  single
callback