refactored some methods to be more elixirly