Reordered lifecycle events

Arranged the beforeCopy event to trigger before the copy event.
Trimmed whitespace and fixed / unified indentation to tabs