restructure code base into modules