implemented pthread function
changed class model