Separated the I2C functions from the main file