Simplified and added asserts