Not fit to fork. Experimental code.