Ported everything but not tested