First version, should be done but not tested IRL.