Added crude exception handling