Fixed memory leak and added foundation for updater