replaced manual unpacking of tuple with pythonic version