edits to BB04 to remove user-defined function