Refactored code for better organization

Refactored code updating singleton structure for better organization