added new style monitor code in sample