Rewritten entire singleton pattern and router logic