Port to python complete, although further testing neccessary