Refactored resource downloading. Increase modularity.