Removal of redundant code and variables