changed function, added action argument