Minor refactor
Fix bug, got my array ops mixed up again
More refactor