adressed comments from Sebastian, added finalise_mog() function