Mouse select support & Code refactoring