Add update functionality; Fixed bugs