removing lots of redundant code