edited to follow example explicitly
index.html output reconfiguration
added require fs
fixed bugs 1