small changes and cleaning some code