working but ugly spanningtrees