Added custom exceptions, updated tests