updated with proper code