Making cloudprint gem threadsafe.

I've made changes across the application that make it usable in multi-threaded environments.