Fixed bug #10

Fixed the empty array bug.

Tidied up code with pyflakes and pep8.