A bit of reorganisation to clean up.
Started erl generation , the easy bits :-)