finish logic