cleanup

replaced some redundant code