changed the custom barrier code