made some classes private and added exception throwing