remove comment headers
simplify function