Updated code to be more generic and include additional examples.