Added more error handling; sealed certain classes