Added new function replaceLines