more code improvments more pythonic.