completely changed tail.py