Reworked main plugin file