working now, need some improvements