add compact sample code to get better understanding