added initial support for milestones
fix some bugs