Replaced errors with exceptions, added new error code.
Minor adjustments regarding blocks.