Freelancer:
yxos
Code fixes
Well, this should do it. Please mind the notes within the code.