hmm, previous solution was not ok, shoud think more functional