move test into condition
made getSubTypeFlags public so that it can be used by groovy script