Code cleanup & updated example