fixed and optimized more scanner stuff