added convenience function elementType

Don't put everything in else block when they do't need to.