Cleaned and documented some of lib/core.arc