added alternate implementation
added benchmark for case vs if