lets rewrite without duplication and redundant statements