Ported basic functions, start debugging logic