Added and implemented singletons

I also changed the structure to use the client/server model idea