Minor refactor mainly for debugging purposes