perl refactoring
fixed perl stacktrace usage
added first round of tests for psgi input with offset
positive tests for psgi input
improved heartbeat mode
check for heartbeat only if heartneat is enabled