Added functions for setting gain and offset values, removed old code