I also had problems with irritability. Especially if I got hurt in some way (like sprained wrist). If I get this way now, it is a clear sign I need to take B6. It fixes it right up.
Both elements are something the body requires in the diet and does not store much. If you go to doctors most will tell you magnesium and b6 have nothing to do with sleep and give you melatonin, which is utterly useless to take regularly. It is very unfortunate how the medical profession is useless regarding fixing well being issues.