Re-organized source code into modules