my code for opensimads as promised cuz i dont have the passion for this any more.