some refactoring
add setup.py

should fix github issue #1