Move each frame type to its own processing method. Add some rules from spec.