Modified errors and general code structure.