Added new functions and improved old ones.