Replaced assert statements with throws.