Modified code a bit