refactor Decoder into separate source file, fail if JOSHUA env var is not set