refactoring to slim down des.ml