Changed replaceAll to replace, removed unnecessary empty String checks