added prolog pattern and new functions