First working version!
Some clean-ups.