add support for listing options and general code cleanup