Some refactoring and autoencoder tests