Add support for loopback 2.x

Adds support for loopback 2.x while maintaining backward compatibility.