refactored into 2 sub packages