This is defined twice.

Also, I would rather loginAPI is declared up in the other vars, and defined when it has to be.