Reorganized JS to make it more portable
- put everything in one function
- some small tweaks to look
- very large changes to structure
Added instructions to README