Moved code into Singleton class - probably needs a better name :)