Added functions initializing listeners for active and inactive array

Was quite a lot of work, don't fuck it up!