Added new pimain.py. More or less finalized structure, so no more test.