added private functions
refactoring and added 'use strict'