added setup.py and split code into a package and separate script