cleaned up algorithm, added a readme and a sample data file