Added new functions and fixed some statements