fix stoplight cop bug and refactor stoplight