program rewritten because of compatibility libraries