added conditionals and fixed the create_resources section