Code cleaning and simplifications