restructure files, add forward algorithm.