argh... still has some bugs.. but i'm half asleep.. so i'll try to figure it out tomorrow