break out testing code, documenting functions