#the part of parallel task removed from previous task
#in some places try changed to try-with-resources
#a lot of str.contains() changed to clearly readable str.matches()