Typos removed, needs more refactoring.