Major refactor of the workings of pretty much every function. Far more error handling now (still not enough - web exceptions will screw the user).

Signed-off-by: Jason Kuster <unexpectedapocalypse@gmail.com>