rearranging code into a proper python package, per #1