making things pythonic and cleanup