finished almost all functions, no make errors/warnings, main() has to be done yet.

-camoz