Fixes #1013
Fixes duplicate line and adds a new clear_profile function
Add plugin hooks
Removed double line
Forgot to globalize $plugins... -.-