Rewritten plugin with proper structure