cleanup
better exception handling