Add tests and clean up A/B testing

Also fixes STUD-1351