added initial threading implementation
added small change
final commit until merge with master