Adding API query functionality and toggle buttons