fixed two macros being used at the same time
added comments and fixes

changed set algorithms