Reorganized the code and updated the readme