make pip installable

created setup.py and moved some code around