bringing in changes from mcgill repo