design state and factory patterns