added JS target (so we no longer need to call emcc by hand)
removed trailing whitespaces
moved to better error interface with a string reference for errors