removed some console logs and refactored code so that errors won't show up in console.