JSDoc fix
Restructuring code