changed replaceAll bit back to code from comment