Pshtetc test race2

refactoring needed: variables "has" and "check" are used only once - "has" should be replaced with in-place test ${!empty...}, and "check" logic should be moved to controller and renamed to meaningful name.