solved priority inversion with shitty approach; need better approach