simplify pattern matching, remove stray end