Added resource loading.
Removed unnecessary code.