1. Changed err return mechnism
2. Minor changes