Modified code a little bit.