Refactor code organization and fix some tests