rewrite & cleanup, preparing for kernel
add c files