Some cleaning and implementation