Stack function add for code factoring
Code refactoring