[WIP] Remove code duplication