Bugfixes & Javascript module

See commits for more detailed information.