Moved some calls from background to main thread