Converted the 'before' function to pass its result to a callback function, instead of as a return statement.