Made various changes to get the code buildable. Some style changes.