better exception handling, especially for databases