Clean/improve the code