fixed compiler errors and updated example