Removed unused recursive function
General cleanup. Named anonymous structures, whitespace and name changes