Catch exceptions and clean up.
Hack together some basic JS to test the function.
IT'S ALIVE.