remove unused code
add remove trailing whitespace function