bug fixes, and rename citation function for clarity