TODO error handling and comments on part1