inlining some usage and updating code to follow samples