fixed basic console error (couldn't define foundation method due to calling a function before defining it)