refactored source code