Fixed issue where the timestamp needed to be passed into function