Refactor: Use singleton pattern to replace static member function