Refactoring and fixed issue with non existen functions.