Validate duration before drawing
Clean up
Merge pull request #5 from ctiao/master

update it