A whole load of changes. Namespaced API functions, cleaned up error handling, caught a previously unhandled I/O exception in bsa_open. Lots of consting and passing by reference added.