Created function for all activities