Added some simple exception handling