basic scanning works, code cleanup