implemented correct sorting (still not really happy with it). going to
test a bit more tonight.