Twist the a few floor wires with each other in the first box and safe them by using a wire nut. Then, connect the end from the shortest ground wire to your environmentally friendly terminal within the switch. In case the appliance will work as envisioned, the wiring is effective. https://smartlightswitches07148.blogocial.com/fascination-about-wiring-to-lights-70498515