Code style clean up and logic clean up in data sent