Some decomposition. Fixed code duplication problem
Some decomposition. Fixed code duplication problem