Rewrite New Task window

Code is more organized now and it also fixes several bugs and
crash-fixes.