Generic portal steps, code tidy up