General cleanup, modified input to deal with similarities