Fixed undefined notices
Added example code