Refactor DecideOnNeed JS module for better readability