Refactor code to have fewer packages