fixing code according to mario's suggestion