Return on errors and unindent giant else clause.
Port metacap service.