Added better exception handling
Added ready state