missing function readded and removed some console logs