add proper test and improve docs