variable scope and return values added