More error checking. Should be done.