changed code using aREST