Added enum for mode instead of string, removed unused code