Re-factoring. Using forEach and map
Implemented recognition for Firefox