changed the code a bit