Made some changes for cleaner code.