refactored to be built as a library, eliminated lua (it's a separate thing now)