Continuing code cleanup and fixed some typing errors