Mode functions

Separated modes into their own functions