added OO error handling