move resources into functions