refactored commission js