made constants public
added content length sanity check