Refactor the get and put fsms

- avoid the use of proplist in favor of get_option, which uses
lists:keyfind internally.

- avoid state mutations wherever possible, typically by grouping them.

- directly construct iolists instead of using io_lib:format/3

- hide tracing stuff behind macros and variables, defaulting to off.