Small fixes here and there
Initial functional version