Restructured some functions
New fields added.