some bugs fixed. still not really working...