if you set this default to @timestamp then you don't need any weird if / else statements later.
and you need to reference it in the code as @target if im not mistaken.