Split main into platform dependent versions. Adds AP-1