implement several frame type using class (refactored)