Non-length curve stuff converted to Lua... needs testing