Lots of fixes,refactoring, new layouts