Fixed date calculations + some cleaning.