Implemented strict/loose and refactored some code.