docs, cleanups, better tests