Various changes and cleanup