added functions for date calculation
updated header