final logic