Adding correct redirect logic to the app