erlang: reworked step read/write implementation