Fixed broken condition.
Added Missing semicolon.
Freed up memory. Removed some unnecessary logs.