Mainfile functionality