Code cleaned version 1.0