migrate bodymodel code to M3