code refactor HEAD and OPTIONS method implemented