Add update functionality

implements update functionality and fixes some PEP8