Make requireable

move index to lib/
write runtime to dir
optionally make templates require-able