first version with drag support
refactoring