updated code
look at ondraw near bottom