code is refactored