Experimental branch added (complete rewrite)