hmm, not really happy with this long if/elseif construct here...