changed handling of availableActions and general method. should work now.