FIX: @amueller comments
Cosmits, code structure and tests