tests and move logic to gem