Revert "Simplify code"

This reverts commit b585e75c31d141a373019d3ef1b7d609a0791b01.