Main code rev. 1709