removed logging, some comments and unused functions.