fixed js layout bug, other misc errors, improved comments