move system stuff into system.h/system.c