troubleshooting 2nd function
moved else console log statement