#598 Refactor after review comments