Started implementation of threading