enhancing output&separating sample code