fixes, refactor finalization