Changed cheaty scope thing to more pythonic way