moved flags to begining of draw func and added dname flag