Add cancel button for replies.
Do some small optimisations on for loops