refactoring in chipher