updated algorithm and cmakelists to include trapclass
basic thing working now, checked with free.xml