updated with new code