All code cleaned & revamped except for functions.c