Minor bugs fixed on final version