getting rid of redundant code