Added exception handling and argparse support, improved checking availability logic

Added exception handling (e.g. checking for correct username and password). Also improved availability checking logic, will first do a check and then wait. Not first wait and then check.