Some Java work done for my friend, Sharyar.