code seems to be working now