Code Refactoring to Fix DateTime bug in lastProcessed