moved to_hal link generation into models