Simplify and bugfix