changed the limit on M for initialisation to 1024 as a reasonable size limit