functions for use-case4 added and working