New functions
Bug fixes.