Fixing layout issues

see issue #88
minor js refactoring, see issue #88