Code cleanup and fixed Git problems