I hope Snjeza could help here, I just extracted it to avoid code duplication.