refactored some code, fixed few bugs
Merge branch 'date-picker' into beta