Sync resources asynchronously.

In theory, it should help keep the UI responsive.
Refactor file.

Renamed some files and added some methods for clarity.