What is the purpose of an architrave?

main purpose is cover the gap of door and window frame and wall and decorative of door and windows