added Option[T] support for write operations (to avoid use Option[T].get), also some changes in the type that return getHeader