Code cleanup. Corrected typos, optimized similar class methods