Fix #15.

Logic bug in the component code. Also reformatted a bit.