added main, corrected various PEP violations