Added the MAIOR sub-routine