improving backend code