update example and functional code