Cleaned some code and started using Singeltons.