refactor struct
use `karma` to test