Move PC control to its own file, refactor code