Some refactor
Rename freelist function to clean
Use K&R style in some functions