added misa's code. It still needs to be fixed reading the files.