added a setup.py, tests, also lots and lots of adjustments after tons of manual testing