Code Clean Up,assertions added