Changes after code review, used orm to calc SLA