Shortened a bit the code