Changed tm bash func to script