Added a setup.py and refactored the code a bit to aid modularity in installation.