added logic in backend