Moved metadata and duration estimation out of if stmt.