Move the _links stuff into a function in hal.core