Many bug fixes & improvements