working correctly now