Condensed everything into one m file