refactored obtain credentials step