added functions and refactored some stuff
initial commit
added clearing trailing whitespaces function