changed structure a little
structure formed
all functions replaced by check