Bound functions and changed some definitions of threads and programs