Exceptions, refactors, y tests