added saving functionality-excludes logging