Converting to script based component and moving connection logic into its own function.