added finishing logic