Base: Bug fixes, better error handling, and some comments