Code refactor part II [validation][finished/not tested]