PEP8 fix.
Remove circular reference.
Handle 1D input gracefully.
Python 2 compatibility.
Activate travis and coveralls.