Small fixes and new functions