Some kind of working (ugly code)