Minor refactoring...

Move check for done