added code from bettlebrox that was missed in merge