Code refactored. Still no idea why browser displays HTTP 301 response
Refactoring. TODO: why browser displays HTTP 302 response?