almost finished... pehaps some bugs