Clean up
Replace assertions with exceptions