working code, previous commit was working too, almost no changes