minor changes and cleaning code