add filter to improve frontier detection; add ability to write data to file; add tests for file stuff