Created lib dir and factored out I2C code