Get rid of that atrocity and implement it more sane.

Signed-off-by: tachyony <tachyony@live.co.uk>