pieces of codes for exercises