first workable code (still not all tags supported)