Main implemented, skeleton code elsewhere.