Moving some code around

Signed-off-by: crynobone <crynobone@gmail.com>