edited for python3 compliance, some work towards parsing arguments