refactored marpis code to something a little more demoable