refactor code to allow for configuration

What's the difference between `attr_accessor` and `attr_writer` here?