Cleaned up the background thread

This should help in making the program less resouce intensive, and start
up faster