fixed and really working now (+ tests)