remove unused code and adding type for datetimestamp condition