Updating code with some scanning stuffs.