Replaced exit expressions with jexit()
Removed some leftover unused variables
Code cleanup & code style