some cleanup and better example