Small improvements
Move set mode rutine, added pre and post command