Cleaner code

shorter and hopefully a bit cleaner code