Add support for resources and small fixes