Reorganized the code into a separate directory