Added most basic error/exception handling and signaling.