Replaced ereg_replace with str_replace on several occasions, should be faster.