Better exception handling and the addition of more tests