Continuing refactoring. WARNING: not compiling!