Created a dedicated function file, add action for password requests
Restructured code using classes and namespace