Added logging for drop events. Some refactoring.