More cleanup
Add comments
Don't export everything with external linkage