modal dialog, + other improvements and cleanup