fix indents and use local var