Fix metrics reporting

Also reduced nesting and indentation to help with the readability and changed some names and comments for consistency.
maybe set finished = true here too?