Cleaning up js file, moving documentation around, greating basic demo.
Further generalisation to demo.