some rudimentary documentation and error handling