Main code rev. 1708