implementing a thread to analyzie layers. Not done yet