Shape detector merged and refactored