refactoring out some stuff

Signed-off-by: Chris Jones <chris@jonezy.org>