Revised code, README updated.