Finished Porter algorithm (haven't bug-tested yet)