Introduced error messages and organized source.