Improve discovery to not include imported classes.