Fix "end" naming and update tests