initial work
recursive scan needs to be implemented.