Added a replace callback as an option