Added function to handle pixels