Plugin code refactored. Proper AutoPlugin implementation