small logical changes on the calculation on the number of frames to send.
formatting changes
- Synchronizing the GUI and the state_changed function.
- Changed vertical to horizontal