Fixed JS side of Issue #97, cleaned up indents