Implemented first API call: setmode