finish basic logic