refactoring: modified to use new API instead of deprecated constants, and replaced hard coded value with constants.
narrowed variable scope
Merge pull request #29 from zaki50/new_api

refactoring: modified to use new API instead of deprecated constants, an...