The use of typeof did not work on Chrome so added parenthesis for clarification of expression
Added forgotten return keyword in callback