added preliminary code for M4, prob paper