added keyboard control 'x' for closing resizer, minor refactorings to share functions