Added better exception handling and usage