Split code for reusing
Split code for reusing - update
Minor fix