updated code a bit more