Finally working (almost)