Whats with checking the mode here? Why is it necessary?