Implementation of the tutorial from http://www.devx.com/Java/Article/47998