backend code cleanup