Various bug fixes and new features added