FIX: more memory efficient + private functions + verbose option