Code clean up and turn two logic fixed