Added some exceptions, fixed some warnings