Added comments/docstrings, change to use the imap and removed locking. Changed default amount of threads to be double cpu count