fixed api resp issue #2, reformatted code pep 8 style