Clean up write functions
Fix pattern matching messages from the port

WIP: use hardcoded patterns to match messages from the port based on the
number of PIDs. These patterns cannot be deterministically created
because of the length field in each of the layered headers.

Other options are making the response from the port deterministic (for example,
by removing the length from the header) or using an intermediary process
to convert the binary to a tuple. Otherwise, the pattern matches should
be generated at compile time, like alcove.erl.