Changes after code review, used orm to calc SLA

The code is ok. :)