added multi-thraeding