Added code to give priority to currently running instance by using an active and idle timeout