refactored client application redirect