Basic mod system + code cleanup