very basic exception handling implemented