Simplified asserts and fixed indentation.