refactoring stylus process