cleanup, error handling, update for html changes