Initial checkin of the portal controller modified for OC and refactored a little.