Refactor resources

Simplify resources handling