Port done. Still some debugging left