refactored singleton