Final rought and undocumented version. Working.