Mainly cosmetic changes. Some bug fixes and data analyitcs