Updated error handling. Began writing real tests.