Defensive errors for now
Completed initial implementation. Now passes all tests