First working version.
some cleanup
some cleanup