Added legacy megan code, could be usefull in the future