Needed improvements: - finalization looks suspicious - input arguments must be validated before passing to Python