Generify and cleanup