partial refactoring of the finish functions