Fixed pointers hell

Passing tests