Added debug for non-working cases.
Fixed bugs, better UI