Split up logic into more methods. Added and used make_resource