[TASK] Move all init.php code in global scope into methods