1. complete password-protected function
2. Refactor code