use non-deprecated code-block for idempotence
object made Serializable (can't believe how stupid I am)