refactored divisibleBy functions into one