Restructured Files; added Error Logging.