Updated lua functions