More functions and better structure