extracting similarity stuff into controller, adopting tests appropriately