stripping and some cleanup
some refactoring and improved stripping