Please validate your inputs. You use `$self` below untested, which is problematic.