Working code from end 2012.