Some encapsulation and error handling