Some bug fixing and some new features