before the mid evoluation: comments added, refactered