erlang: reworked RS as array
erlang: cleaned up pop/push a bit more