added toString and removed the console.log calls from the implementation