Cleaning code up, fixing functions

Adding in exception classes, fixing some functions in the analog class.