Refactoring return values.

Refactoring return values. Added return request method to handle return
codes and messages.