Commit 4: Reorganization, and also fixed code