stack overflow resolved(ish)