Added x.bash and updated thread.bash to use it