Fixed handle error. Added a few useful comments.