Removed some console.writeline and fixed replace bug