Little code refactor - singleton pattern etc.