Minor rework. Still not finished