Adding threading for UI

Unstable