writing functions added