Ported some files from pic/flip solver