Importing commits from Xandros repo

Close #397.
Close #398.
Close #399. 
Close #400.  See #410, #412 .
Close #401. 
Close #402.  See #411 .
Close #403. 
Close #404. 
Close #405. 
Close #406. 
Close #407. 
Close #408.