use callbacks with replace for better performance. fix bug in prepend with multiple dollar signs