Bunch of changes and cleanup