MAINT: cleaned up function and documentation