Refactored tail api