Refactor code so key and secret are private variables