modified to not make constant on/off switches