added some code - seems to be working