added save_api_credentials method to config
refactored bin a bit