efficient case class copy and more logic