refactor by commands. the initialize function will be refactored with decoration pattern next time.