Update to Resource

Just added interaction with database, renamed a few functions, ready to
test on server