Remove outdated code
Add comments; Refactor getResource() a little