use threading for increased readability