Fine tuning and minor bugs correction