Merge the A/B test function changes

Fixed the following issues:

#30
#12
#8