added the pencil button functionality