Code cleaned and bugs fixed.