Sample code from jfocus