Changed to more 'pythonic' way