tim function def. added