Fixed thanks indexes and cleaned up logic.