Added 'before' and 'after' callbacks.