move functions to .c, add basic prefetch queue