Code to maintain compatability across major scala versions