finally solved this bloody thing