mofify unreadable code
remove console.log
adopt promise