Bug fixing and removing console.logs