added clean routine
compiles on mac and centos, fixes  #1