py3 compatible and PEP 8'd