add index and test; tweak various files for npm packaging