Added some code to handle updates and such