refined a bit but still not working