Improve code for the simple cpu sensor, write test