Refactored to improve jvm local handling, completed for statement in jvm