Allow customizable pattern and callback

@samuelcole how is this?