Small optimization
Throw exceptions instead of using asserts