Clean it  up

Added documentation, standardized tabs, modifed error behavior